<?php

namespace app\modules\v1\models;

use Yii;

/**
 * This is the model class for table "{{%_user}}".
 *
 * @property integer $id            (用户ID)
 * @property string $password       (Client密码)
 * @property string $justtalk       (justalk密码==初次Client密码)
 * @property string $status         (认证状态)
 * @property string $telephone      (手机/登录帐号)
 * @property string $createdate     (创建日期)
 */
class User extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%_user}}';
    }

    /**
     * @inheritdoc
     * ERROR CODE
     * 401 空值
     * 402 重复
     * 403 超出范围
     * 404 不存在
     */
    
    public function rules()
    {
        return [
            [['password', 'telephone','justtalk'], 'required','message' => 401],
            [['telephone', 'id'],'unique','message' => 402],
            [['password'], 'string', 'length' => [32,64],'tooShort' => 403,'tooLong' => 403],
            [['telephone'], 'string', 'length' => [11,11],'tooShort' => 403,'tooLong' => 403],
            [['createdate'], 'string', 'max' => 32],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'password' => 'Password',
            'justtalk' => 'Justtalk',
            'stauts' => 'Status',
            'telephone' => 'Telephone',
            'createdate' => 'Createdate',
        ];
    }
}
